package com.sans.linear;

import java.util.Scanner;

/**
 * @author Sans
 */

/**
 * 输入班级人数，记录每个同学的名字和每个人的分数，要求最终显示结果为： XX分数是XXX，且本次考试XX考的最好，为XXX分。
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入班级人数:");
        int num = scanner.nextInt();
        int maxScore = -1;
        String maxScoreOwner = "";
        String[] infos = new String[num];
        for (int i = 0; i < num; i++) {
            System.out.println("请输入第" + (i + 1) + "个同学的姓名:");
            String name = scanner.next();
            System.out.println("请输入第" + (i + 1) + "个同学的分数:");
            int score = scanner.nextInt();
            infos[i] = name + "的分数是" + score;
            if (score > maxScore) {
                maxScore = score;
                maxScoreOwner = name;
            }
        }
        for (String info : infos) {
            System.out.println(info);
        }
        System.out.println("本次考试" + maxScoreOwner + "考的最好,为" + maxScore + "分！");
        scanner.close();
    }
}
